package Lesson4;

import java.util.Arrays;
import java.util.Scanner;

public class Task4 {

	public static void main(String[] args) {

		Scanner sc = new Scanner (System.in);
		System.out.println("Enter the length of the array");
		
		int length = sc.nextInt();
		int[] arr = new int [length];
		int[] help = new int [arr.length];
		int sec = 0;
		
		
		int num;
		
		System.out.print( "Enter the numbers of the array");
		for (int i = 0; i < arr.length; i++)
		{
			System.out.print((i+1)+". ");
			num = sc.nextInt();
			arr [i] = num;
		}
		System.out.println();
		
		
		for(int i = 0; i < arr.length; i++)
		{
			if(arr[i] != 0)
			{
				help[sec]=arr[i];
				sec++;				
			}
			
		}
		System.out.println();
		System.out.println(Arrays.toString(help));
	}

}
